﻿using System;
using System.Data;
using System.Data.Entity;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using FashionShop.Models;

namespace FashionShop.Areas.Home.Controllers
{
    public class ProductCatalogueController : HomeAppController
    {
        //
        // GET: /Home/ProductCatalogue/

        public ActionResult Index(string url)
        {
            var catalogue = db.ProductCatalogue.Where(m => m.URL == url).FirstOrDefault();
            if (catalogue == null)
                return HttpNotFound();
            ViewBag.Catalogue = catalogue;
            //New Products
            var product = db.Product.Include(p => p.Brand).Include(p => p.ProductCatalogue);
            ViewBag.Products = product.OrderByDescending(m => m.Created).Where(m => m.ProductCatalogueID == catalogue.ProductCatalogueID).Take(16).ToList();
            //Quan ao
           

            return View();
        }

    }
}
